// src/types/station.ts

// 站点列表响应
export interface StationListResponse {
    pageIndex: number
    pageSize: number
    stationList: Station[]
    total: number
    totalPage: number
  }
  
  // 充电站基础信息
  export interface Station {
    // 基础信息
    stationId: string
    stationName: string
    address: string
    brandName: string
    distance: number
    lat: number
    lng: number
    
    // 费用信息
    electricityPrice: number
    servicePrice: number
    totalCostPrice: number
    parkCost?: number
    
    // 运营信息
    openTime: string
    parkFee: string
    operatorId: string
    stationTel: string
    openStatus: number
    stationStatus: number
    
    // 充电桩数量
    quickAvailableNum: number
    quickChargeNum: number
    slowAvailableNum: number
    slowChargeNum: number
    
    // 扩展字段
    brandType?: number
    stationLevel?: number
    stationGradeScore?: number
    stationCategory?: number[]
  }
  
  // 站点详情
  export interface StationDetail {
    stationId: string
    stationName: string
    address: string
    stationLat: number
    stationLng: number
    busineHours: string
    parkFee: string
    serviceTel: string
    siteGuide: string
    pictures: string[]
    
    // 充电桩统计
    quickAvailableCount: number
    quickTotalCount: number
    slowAvailableCount: number
    slowTotalCount: number
    
    // 充电枪列表
    fastConnectors: FastConnector[]
    
    // 时段价格
    periodPrices: PeriodPrice[]
    
    operatorId: string
    stationStatus: number
    stationTel: string
    
    // 扩展字段
    chargeModes?: number[]
    electricityFee?: string
    serviceFee?: string
    parkMode?: number
    parkNums?: number
  }
  
  // 快充充电枪
  export interface FastConnector {
    connectorId: string
    connectorName: string
    power: number
    status: number // 0:离网 1:空闲 2:占用 3:充电中 4:锁定 255:故障
    connectorType?: number
    lockFlag?: number
    sortLabel?: number
  }
  
  // 时段价格
  export interface PeriodPrice {
    eleFee: string
    serviceFee: string
    totalFee: string
    startTime: string
    endTime: string
    currentFlag?: boolean
    nextFlag?: boolean
  }
  
  // 充电会话
  export interface ChargingSession {
    id: string
    stationId: string
    startTime: Date
    startPower: number
    stationPrice: number
    status: 'charging' | 'completed' | 'error'
    connectorId?: string
  }
  
  // 充电站状态类型
  export type StationStatus = 'free' | 'busy' | 'maintenance'
  
  // 搜索参数
  export interface StationSearchParams {
    keyword?: string
    lat?: number
    lng?: number
    radius?: number
    brandName?: string
    minAvailable?: number
    maxPrice?: number
  }
  
  // 新增类型定义 - 充电会话详情
  export interface ChargingSessionDetail {
    sessionId: string
    stationId: string
    stationName: string
    connectorId: string
    connectorName: string
    startTime: Date
    estimatedEndTime: Date
    currentPower: number
    totalCost: number
    status: 'preparing' | 'charging' | 'completed' | 'error' | 'stopped'
    powerRate: number
    duration: number
  }
  
  // 新增类型定义 - 路线信息
  export interface RouteInfo {
    distance: string
    duration: string
    steps: RouteStep[]
    polyline?: number[][] // 路线坐标点
  }
  
  // 新增类型定义 - 路线步骤
  export interface RouteStep {
    instruction: string
    distance?: string
    duration?: string
    path?: number[][] // 步骤路径坐标
  }
  
  // 新增类型定义 - 位置信息
  export interface LocationInfo {
    latitude: number
    longitude: number
    address?: string
    accuracy?: number
    timestamp?: number
  }
  
  // 新增类型定义 - 充电请求参数
  export interface ChargingRequest {
    stationId: string
    connectorId?: string
    chargeMode?: 'fast' | 'slow'
    expectedDuration?: number
    expectedPower?: number
  }
  
  // 新增类型定义 - 充电响应
  export interface ChargingResponse {
    success: boolean
    sessionId?: string
    message?: string
    errorCode?: string
  }
  
  // 新增类型定义 - 虚拟滚动列表项属性
  export interface StationListItemProps {
    station: Station
    isSelected: boolean
    isCharging?: boolean
    currentLocation?: LocationInfo | null
  }
  
  // 新增类型定义 - 充电站操作事件
  export interface StationActionEvents {
    select: Station
    charge: Station
    showRoute: Station
    toggleFavorite?: Station
  }
  
  // 新增类型定义 - 充电站状态统计
  export interface StationStats {
    totalStations: number
    availableStations: number
    chargingStations: number
    maintenanceStations: number
    averagePrice: number
  }
  
  // 新增类型定义 - 品牌信息
  export interface BrandInfo {
    brandName: string
    brandType: number
    stationCount: number
    averageRating: number
    logoUrl?: string
  }
  
  // 新增类型定义 - 价格范围
  export interface PriceRange {
    min: number
    max: number
    average: number
  }
  
  // 新增类型定义 - 充电站过滤器
  export interface StationFilter {
    brandNames?: string[]
    priceRange?: PriceRange
    availableOnly?: boolean
    fastChargeOnly?: boolean
    distanceRange?: number
    ratingMin?: number
  }
  
  // 新增类型定义 - 用户偏好
  export interface UserPreference {
    favoriteBrands: string[]
    preferredPriceRange: PriceRange
    maxDistance: number
    chargeMode: 'fast' | 'slow' | 'both'
  }